{% set APP_NAME = pillar.get('app_name') %}
{% set COMMIT = pillar['commit'] %}
{% set WORKSPACE = pillar['workspace'] %}
{% set BACKUP_DIR =  pillar['backup_dir'] %}
{% set PRO_NAME = pillar['pro_name'] %}
{% set ENV = pillar['env'] %}

backup_lib:
  cmd.run:
    - name: |
        cp {{WORKSPACE}}/{{PRO_NAME}}/target/*.jar {{BACKUP_DIR}}/{{APP_NAME}}/{{COMMIT}}/lib/

backup_conf:
  cmd.run:
    - name: |
        cp {{WORKSPACE}}/{{PRO_NAME}}/conf/{{ENV}}/* {{BACKUP_DIR}}/{{APP_NAME}}/{{COMMIT}}/conf/
        cp {{WORKSPACE}}/{{PRO_NAME}}/conf/commons/* {{BACKUP_DIR}}/{{APP_NAME}}/{{COMMIT}}/conf/
